package com.example.task.task;

import com.xxl.job.core.context.XxlJobHelper;
import com.xxl.job.core.handler.annotation.XxlJob;
import org.springframework.stereotype.Component;

import java.util.concurrent.TimeUnit;

/**
 *@author zhangyangyang
 *@createTime 2023423 11:14
 *@description 数据同步任务
 */
@Component
public class DataSyncTask {

    @XxlJob("mileageJobHandler")
    public void mileageJobHandler() throws Exception {
        XxlJobHelper.log("数据同步任务开始执行");

        for (int i = 0; i < 5; i++) {
            XxlJobHelper.log("beat at:" + i);
            analysisData();
            TimeUnit.SECONDS.sleep(2);
        }
        // default success
    }

    public void analysisData() {
        // 任务处理
    }
}
